package com.chen.service.impl;

import com.chen.mapper.UserMapper;
import com.chen.entity.User;
import com.chen.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Transactional
@Service
public class UserServiceImpl implements UserService {
   @Autowired
   private UserMapper userMapper;
    @Override
    @Transactional(readOnly = true)
    public List<User> selectAll() {
        List<User> userList=userMapper.selectAll();
        return userList;
    }

    @Override
    public Integer insertUser(User user) {
        return userMapper.insertUser(user);
    }

    @Override
    public Integer updateById(User user) {
        return userMapper.updateById(user);
    }

    @Override
    public Integer deleteById(Long id) {
        return userMapper.deleteById(id);
    }

    @Override
    public List<User> selectByName(String name) {
        return  userMapper.selectByName(name);
    }

}
